package com.xz.service.impl;

import com.xz.dao.ItemDao;
import com.xz.entity.JdItemEntity;
import com.xz.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zhangh     
 * @version V1.0.0
 * @projectName selfstudy-crawler
 * @title     ItemServiceImpl   
 * @package    com.xz.service.impl  
 * @date   2019/10/10 17:32  
 * @explain
 */
@Service
public class ItemServiceImpl implements ItemService {

    @Autowired
    private ItemDao itemDao;

    /**
     * 保存数据
     * @param itemEntity
     */
    @Override
    public void save(JdItemEntity itemEntity) {
        this.itemDao.save(itemEntity);
    }

    /**
     * 根据条件查找数据
     * @param conditionEntity
     * @return
     */
    @Override
    public List<JdItemEntity> findAll(JdItemEntity conditionEntity) {
        Example<JdItemEntity> example = Example.of(conditionEntity);

        List<JdItemEntity> itemEntities = this.itemDao.findAll(example);

        return itemEntities;
    }
}
